package com.wondertek.web.controller.business;

import com.wondertek.common.base.Result;
import com.wondertek.service.dto.business.res.*;
import com.wondertek.service.service.business.WebHomePageService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author wangyu
 */
@RestController
@RequestMapping("/backend/business/home/page")
@Tag(name = "web首页")
public class WebHomePageController {

    @Autowired
    private WebHomePageService webHomePageService;

    /**
     * 顶部
     *
     * @return
     */
    @GetMapping("/findTop")
    @Operation(summary = "首页顶部")
    public Result<WhpTopRes> findTop() {
        return Result.success(webHomePageService.findTop());
    }

    /**
     * 地图查询站点下相关信息
     *
     * @param siteId
     * @return
     */
    @GetMapping("/findMapSiteBySiteId")
    @Operation(summary = "地图查询站点下相关信息")
    public Result<WhpMapSiteRes> findMapSiteBySiteId(@RequestParam("siteId") String siteId) {
        return Result.success(webHomePageService.findMapSiteBySiteId(siteId));
    }

    /**
     * 右侧设备和配件类型统计
     *
     * @return
     */
    @GetMapping("/findRight")
    @Operation(summary = "右侧设备和配件类型统计")
    public Result<List<WhpRightRes>> findRight() {
        return Result.success(webHomePageService.findRight());
    }

    /**
     * 左下角最近30天新增
     *
     * @return
     */
    @GetMapping("/findBottomLeft")
    @Operation(summary = "左下角最近30天新增")
    public Result<WhpBottomLeftRes> findBottomLeft() {
        return Result.success(webHomePageService.findBottomLeft());
    }

    /**
     * 底部中间统计30天内每天新增告警数
     *
     * @return
     */
    @GetMapping("/findBottomCentre")
    @Operation(summary = "底部中间统计30天内每天新增告警数")
    public Result<List<WhpBottomCentreRes>> findBottomCentre() {
        return Result.success(webHomePageService.findBottomCentre());
    }

    /**
     * 底部右边设备故障(离线)数统计
     * @return
     */
    @GetMapping("/findBottomRight")
    @Operation(summary = "底部右边设备故障(离线)数统计")
    public Result<WhpBottomRightRes> findBottomRight(){
        return Result.success(webHomePageService.findBottomRight());
    }


}
